import http from "../request";
const apibase = "/api/CalExcuteScriptDetail";

//获取计算脚本详情
var getCalExcuteScriptDetails = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/GetCalExcuteScriptDetails`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//批量新增脚本详情
var addCalExcuteScriptDetails = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/AddCalExcuteScriptDetails`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//批量修改脚本详情
var updateCalExcuteScriptDetails = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/UpdateCalExcuteScriptDetails`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//删除脚本详情
var deleteCalExcuteScriptDetail = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/DeleteCalExcuteScriptDetail`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

export {
  getCalExcuteScriptDetails,
  deleteCalExcuteScriptDetail,
  updateCalExcuteScriptDetails,
  addCalExcuteScriptDetails,
};
